//
//  titleButton.swift
//  LXQWB
//
//  Created by 江海天 on 2017/7/5.
//  Copyright © 2017年 江海天. All rights reserved.
//

import UIKit

class titleButton: UIButton {
	
	override init(frame: CGRect) {
		super.init(frame: frame)
		setInitInfo()
	}
	
	required init?(coder aDecoder: NSCoder) {
		fatalError("init(coder:) has not been implemented")
	}
	
	override func layoutSubviews() {
		super.layoutSubviews()
		
		titleLabel?.frame.origin.x = 0
		imageView?.frame.origin.x = (titleLabel?.frame.width)!
		
	}
	
	///初始化titleView
	func setTitle(title:String?){
		setTitleColor(UIColor.gray, for: UIControlState.normal)
		//NLog(message: (title ?? "" + "123"))
		setTitle(title ?? "" + " ", for: UIControlState.normal)
	}
	
	private func setInitInfo(){
		
		setImage(UIImage(named: "navigationbar_arrow_down"), for: UIControlState.normal)
		setImage(UIImage(named: "navigationbar_arrow_up"), for: UIControlState.selected)
		
	}
}
